package com.example.rabbitmq.producer.delay.controller;/**
 * ClassName: RabbitmqDelayQueueController <br/> Description: <br/> date: 2022/1/24 15:12<br/>
 *
 * @author chenzhian<br />
 * @version
 */

import com.example.rabbitmq.producer.delay.service.CustomSender;
import com.example.rabbitmq.producer.delay.service.DelaySender;
import java.util.Date;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: chenzhian
 * @Date: 2022/1/24 15:12
 * @Description:
 */
@RestController
@RequestMapping("/delay")
@Slf4j
public class RabbitmqDelayQueueController {

  @Resource
  private DelaySender delaySender;

  @GetMapping("/{message}/{delayedTime}")
  public void delayedTimeMessage(@PathVariable String message, @PathVariable Integer delayedTime) {
    log.info("当前时间：{} 发送一条信息给delayed交换机{},delayedTime：{}", new Date(), message,
        delayedTime);
    delaySender.send(message, delayedTime);
  }


}